package com.jingtai.shop.webfacade.bo.shopcar;

import com.jingtai.common.webfacade.BaseBO;
import com.jingtai.common.webfacade.error.CommonException;
import com.jingtai.common.webfacade.error.ErrorEnum;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.apache.commons.lang3.StringUtils;

/**
 *  修改购物车商品的数量
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class ModifyShopCarQuantityBO extends BaseBO {

    /**
     * 商品ID
     */
    private Long goodsId;

    /**
     * 数量
     */
    private Long quantity;

    /**
     * 原来的sku编码
     */
    private String oldSkuCode;

    /**
     * sku编码
     */
    private String skuCode;

    @Override
    public void validate() {
        super.validate();

        if (goodsId == null
                || StringUtils.isBlank(skuCode)) {
            throw new CommonException(ErrorEnum.REQUIRED_PARAM_EMPTY);
        }
    }
}
